package com.lmx.persistence.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.lmx.persistence.service.common.BaseCrudServiceImpl;
import com.lmx.repoDomain.tmodel.Food;


/**
 * 食物 ServiceImpl
 *
 * @author ytche
 * @date 2017年8月30日
 *
 */
@Service
public class FoodServiceImpl extends BaseCrudServiceImpl<Food> implements FoodService {
	@Override
	public Integer checkFoodRelations(Food food) {
		String queryStr = "From CustomerFoodPlan where delStatus=0 " + " and food.id=:id ";
		List<Food> list = super.em.createQuery(queryStr).setParameter("id", food.getId()).getResultList();
		return list == null || list.size() < 1 ? 0 : list.size();
	}

}
